package d0817_RefTypeAndThreadLocal;

import java.lang.ref.WeakReference;

/**
 * @Program: thread
 * @Description: 弱引用
 * @Author: Mr.Yiu
 * @CreatedTime: 2021-08-17 15:19
 **/
public class T03_WeakReference {
    public static void main(String[] args) {
        WeakReference<M> m = new WeakReference<>(new M());

        System.out.println(m.get());
        System.gc();
        System.out.println(m.get());

        ThreadLocal<M> tl = new ThreadLocal<>();
        tl.set(new M());
        tl.remove();
    }
}
